home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / eulisp / mpfeel.lha / MPFeel / Plurals / mp_debug.h < prev    next >
C/C++ Source or Header  |  1992-05-12  |  2KB  |  73 lines

  1. /*
  2.  *    Debugging
  3.  *
  4.  *    Author:    S.C.Merrall
  5.  *
  6.  *    File:    debug_off.h
  7.  *
  8.  *    Contents:    DBG_CALL   - register function entry
  9.  *                      DBG_ARGS   - list argument values
  10.  *                      DBG_EXIT   - register function exit
  11.  *
  12.  *    Description:    This contains dummy entries for the debug.h macros
  13.  *                      This header is included into a file when you want 
  14.  *                      to stop debug output in that file
  15.  *
  16.  *    Change History:
  17.  *
  18.  *    Date   Name Comment
  19.  *    -------- ---- -------
  20.  *    06:02:91 SCM  Created
  21.  *
  22.  */
  23.  
  24. #ifdef DBG_2_STDERR
  25.  
  26. #define dbg stderr
  27.  
  28. #else
  29.  
  30. extern FILE *dbg;
  31.  
  32. #endif
  33.  
  34. extern char *dbg_g_fname;
  35. extern plural short dbg_g_active;
  36. extern char *spaces;
  37. extern int debug_status;
  38.  
  39. #define DBG_ON() debug_status=TRUE
  40. #define DBG_OFF() debug_status=FAIL
  41.  
  42. #ifdef __STDC__
  43.  
  44. extern int init_debug( void );
  45.  
  46. #else
  47.  
  48. extern int init_debug();
  49.  
  50. #endif
  51.  
  52. #define DBG_CALL(name) char *old_dbg_fname=dbg_g_fname;char *dbg_fname = name;\
  53.                        dbg_g_fname = dbg_fname 
  54. #define DBG_ARGS(args) if (debug_status) {fprintf(dbg,"%s(",dbg_fname);args;fprintf(dbg,")\n");}
  55. #define DBG_EXIT(out)  if (debug_status) {fprintf(dbg,"%s => ",dbg_fname);out;fprintf(dbg,"\n");}\
  56.                        dbg_g_fname=old_dbg_fname
  57. #define DBG_NULL(ptr)
  58. #define DBG_FAIL(out)  fprintf(dbg,"%s => ",dbg_fname);out;fprintf(dbg,"\n");\
  59.                        dbg_g_fname=old_dbg_fname
  60. #define DBG_EROR(err)  mp_error = err;return FAIL
  61.  
  62. #define DBG_NO_OF_PES 7
  63.  
  64. #define DBG_CTXT() dbg_g_active=enumerate();if (dbg_g_active<DBG_NO_OF_PES)
  65.  
  66. #define DBG_PVAR(str,name,format,value) fprintf(str,"%s=",name);dbg_g_active=enumerate(); if(dbg_g_active<DBG_NO_OF_PES) p_fprintf(str,format,value);fprintf(str,"...")
  67.  
  68. #define DBG_PARG(name,format,value) DBG_PVAR(dbg,name,format,value)
  69.  
  70. #define DEBUG(body) if (debug_status) {fprintf(dbg,"%s debug: ",dbg_fname);body;fprintf(dbg,"\n");}
  71.  
  72. #define DO_DEBUG(body) DEBUG(body)
  73.